import Vue from 'vue';
import VueRouter from 'vue-router';
import routes from './routes';
import NProgress from '@plugins/_nprogress';

Vue.use(VueRouter);

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
});

router.beforeEach((to, from, next) => {
    NProgress.start();
    next();
});

router.afterEach((to, from) => {
    NProgress.done();
});

export default router;
